package com.travel.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.travel.entity.TbView;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface ViewMapper extends BaseMapper<TbView> {

    @Select("SELECT * FROM tb_view  ORDER BY view_price DESC")
    @Results(value = {
            @Result(id = true,column = "view_id",property = "viewId"),
            @Result(column = "city_id",property = "cityId"),
            @Result(column = "view_name",property = "viewName"),
            @Result(column = "view_pic",property = "viewPic"),
            @Result(column = "view_info",property = "viewInfo"),
            @Result(column = "view_pic1",property = "viewPic1"),
            @Result(column = "view_info1",property = "viewInfo1"),
            @Result(column = "view_addr",property = "viewAddr"),
            @Result(column = "view_price",property = "viewPrice"),
            @Result(column = "view_mark",property = "viewMark")
    })
    List<TbView> findDesc();
    @Select("SELECT * FROM tb_view  ORDER BY view_price")
    @Results(value = {
            @Result(id = true,column = "view_id",property = "viewId"),
            @Result(column = "city_id",property = "cityId"),
            @Result(column = "view_name",property = "viewName"),
            @Result(column = "view_pic",property = "viewPic"),
            @Result(column = "view_info",property = "viewInfo"),
            @Result(column = "view_pic1",property = "viewPic1"),
            @Result(column = "view_info1",property = "viewInfo1"),
            @Result(column = "view_addr",property = "viewAddr"),
            @Result(column = "view_price",property = "viewPrice"),
            @Result(column = "view_mark",property = "viewMark")
    })
    List<TbView> viewAsc();

    @Select("SELECT view_name FROM tb_view WHERE view_addr = #{viewAddr}")
    @Results(value = {
            @Result(id = true,column = "view_id",property = "viewId"),
            @Result(column = "city_id",property = "cityId"),
            @Result(column = "view_name",property = "viewName"),
            @Result(column = "view_pic",property = "viewPic"),
            @Result(column = "view_info",property = "viewInfo"),
            @Result(column = "view_pic1",property = "viewPic1"),
            @Result(column = "view_info1",property = "viewInfo1"),
            @Result(column = "view_addr",property = "viewAddr"),
            @Result(column = "view_price",property = "viewPrice"),
            @Result(column = "view_mark",property = "viewMark")
    })
    List<TbView> findName(String cityName);
}


